-- @owner: cr13
-- @date: 2024-10-15
-- @testpoint: 创建自定义函数判断参数是否为binary_double_infinity、binary_double_nan无限大

--step1:打开float_suffix_acceptance参数 expect:成功
set float_suffix_acceptance = on;
show float_suffix_acceptance;

--step2:创建定义逸函数 expect:成功
drop function if exists f_fun_0037;
CREATE FUNCTION f_fun_0037(value FLOAT)
RETURNS FLOAT
LANGUAGE plpgsql
AS $$
BEGIN
--判断参数是否为正无穷大
IF value = binary_double_infinity THEN
RETURN 1.0;
ELSE
RETURN 0.0;
END IF;
END;
$$;
/

--step3:调用自定义函数，传递binary_double_infinity作为参数 expect:返回1.0
SELEcT f_fun_0037(binary_double_infinity);
-- 返回 1.0

--step4:清理环境 expect:成功
drop function if exists f_fun_0037;
